<extend name="./Application/Common/View/block/base.php" />
<block name="header">
    <include file="./Application/Admin/View/block/easyui_header.php" />
    <link href="/extend/umeditor/themes/default/css/umeditor.min.css" type="text/css" rel="stylesheet">
    <link href="__PUBLIC__/css/table_css.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="/Public/uploadfy/uploadify.css" />
</block>
<block name="bdoy">
    <body>
    <form action="" method="post" onsubmit="return $(this).form('validate');">
        <table cellspacing="0" width="100%" class="">

            <tr>
                <td class="label"><strong>{:LANG('kv_name')}: </strong></td>
                <td class="form-line">
                    <input class="easyui-textbox easyui-validatebox input-text" name="comment" id="comment" size="50" style="height: 24px;line-height: 24px;"
                           data-options="prompt:'{:LANG('pls_input')}{:LANG('kv_name')}',required:true,validType:'length[1,50]'">
                </td>
            </tr>
            <tr>
                <td class="label"><strong>{:LANG('kv_key')}: </strong></td>
                <td class="form-line">
                    <input class="easyui-textbox easyui-validatebox input-text" name="key" id="key" size="50" style="height: 24px;line-height: 24px;"
                           data-options="prompt:'{:LANG('pls_input')}{:LANG('kv_key')}',required:true,validType:'length[1,50]'">
                </td>
            </tr>
            <tr>
                <td class="label"><strong>{:LANG('kv_type')}: </strong></td>
                <td class="form-line">
                    <input class="chiose" type="radio" name="input_type" value="input" id="input"/> <label>{:LANG('text')}</label>
                    <input class="chiose" type="radio" name="input_type" value="textarea" id="textarea"/> <label>{:LANG('textarea')}</label>
                    <input class="chiose" type="radio" name="input_type" value="image" id="image"/> <label>{:LANG('image')}</label>
                    <input class="chiose" type="radio" name="input_type" value="file" id="file"/> <label>{:LANG('file')}</label>
                </td>
            </tr>
            <tr>
                <td class="label"><strong>值: </strong></td>
                <td class="form-line" id="insert-div">
                </td>
            </tr>


            <tr>
                <td class="label"></td>
                <td class="form-line">
                    <input type="submit" class="submit-button bule-button" value="{:LANG('save')}">
                    <input type="button" onclick="close_dialog()" class="submit-button" value="{:LANG('cancel')}">
                </td>
            </tr>
        </table>
    </form>
    </body>
</block>
<block name="footExtendJs">
    <script type="text/javascript" src="/Public/uploadfy/jquery.uploadify.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/admin/key_to_value.js"></script>
    <script>
        $('#input').attr('checked', true);
        $('#insert-div').append(getInputDiv());
        $('.chiose').click(function(){
            var id = $(this).attr('id');
            console.log(id);
            var innsert = $('#insert-div');
            innsert.empty();
            if(id=='input'){
                innsert.append(getInputDiv());
            }else if(id == 'textarea'){
                innsert.append(getTextareaDiv());
            }else{
                innsert.append(getFileDiv());
                $('#file_upload').uploadify({
                    'swf'      : '/Public/uploadfy/uploadify.swf',
                    'uploader' : '__URL__/uploadify',
                    'buttonText' : '{:LANG('upload_file')}',
                    'onUploadSuccess' : function(file, data, response) {
                        $("#value").val(data);
                    }
                });
            }
        });
    </script>


</block>
